package com.perfect

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlin.coroutines.CoroutineContext

object ProcessCoroutineScope : CoroutineScope {
    private var shadowContext: CoroutineContext? = null

    override val coroutineContext: CoroutineContext
        get() {
            if (shadowContext != null) return shadowContext!!
            return (SupervisorJob() + Dispatchers.Main.immediate).also {
                shadowContext = it
            }

        }
}